/**
 * Created by lenovo on 2017/5/10.
 */
import React from 'react';

// import avatar4 from '../img/avatar4.jpg';

class EvaluateReplyMessage extends React.Component{
    constructor(props){
        super(props);

        this.state = {
            messageReply:{
                avatar: '',
                nickname: '',
                reply_time: '',
                desc: ''
            }
        }
    }

    componentDidMount(){
        let messageReply = this.props.messageReply;
        this.setState({
            messageReply:{
                avatar: messageReply.avatar,
                nickname: messageReply.nickname,
                reply_time: messageReply.reply_time,
                desc: messageReply.desc
            }
        })
    }

    componentWillReceiveProps(nextProps){
        let messageReply = nextProps.messageReply;
        this.setState({
            messageReply:{
                avatar: messageReply.avatar,
                nickname: messageReply.nickname,
                reply_time: messageReply.reply_time,
                desc: messageReply.desc
            }
        })
    }

    render(){
        const messageReply = this.props.messageReply;
        // messageReply返回的数据结构
        // {
        //     nickname: "我在人民广场吃炸猪",
        //     desc: "早没看见你的评论啊，找了一下午没找到。",
        //     reply_time: "15-09-26 18:22 ",
        //     avatar: avatar6,
        //     reply_target: ""
        // }

        if(messageReply!==[]){
            return(
                <div className="replyMessageContainer">
                    <div className="evaluateTitle">
                        <img className="avatarSizeS avatarRadius" src={this.state.messageReply.avatar} />
                        <span className="userName userNameFontL userNameColor">{this.state.messageReply.nickname}</span>
                        <div className="evaluateTimeBox">
                            <span className="evaluateTime specialItemFont">{this.state.messageReply.reply_time}</span>
                        </div>
                    </div>
                    <article className="replyArticle">
                        {/*牛肉诱惑稻粉，本来想点泡菜肥牛，服务员提醒是最辣的，推荐了这个。*/}
                        {/*牛肉微辣，番茄汤底，微辣融合到番茄汤里面，口感丰富味道正正好。*/}
                        {/*牛肉块还蛮大的，大概六块，有肉有筋，品质不错。*/}
                        {/*配料里有油炸过脆脆的豌豆黄，很香，个人很喜欢。*/}
                        {/*粉不够可以免费加，细细嫩嫩的，我觉得比外面桂林米粉的那种粉好吃很多。*/}
                        {this.state.messageReply.desc}
                    </article>
                </div>
            )
        }else{
            //测试使用
            return <div>error</div>;
        }

    }
}

export default EvaluateReplyMessage;